package com.woniuxy.classdeans.controller;

import com.woniuxy.classdeans.exception.ClassdeansException;
import com.woniuxy.classdeans.service.TeamMasterService;
import com.woniuxy.commons.entity.wyh.TeamMaster;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 班主任
 * @author 王艳辉
 * @date 2020/7/22 - 12:33
 */
@RestController
@RequestMapping("/teamMaster")
@Slf4j
public class TeamMasterController {
    @Autowired
    private TeamMasterService teamMasterService;

    /**
     * 新增班主任
     * @param teamMaster
     * @return
     */
    @RequestMapping("add")
    public int addTeamMaster(TeamMaster teamMaster){
        int res;

        try {
            res = teamMasterService.addTeamMasert(teamMaster);
        }catch (Exception e) {
            log.error(e.getMessage());//日志记录
            //抛自定义异常
            throw new ClassdeansException("teamMaster/add异常");
        }

        return res;
    }


}
